﻿Imports System.Configuration

Namespace DomainModels
    Public Class Schedule
        Inherits DomainModelBase

        Friend Sub New()
            Employee = New Employee
            Subject = New Subject
        End Sub

        Public Property ScheduleId As Integer
        Public Property Employee As Employee
        Public Property Subject As Subject
        Public Property RoomNumber As String
        Public Property ScheduleDay As String
        Public Property StartTime As DateTime
        Public Property EndTime As DateTime
        Public Property StartDate As DateTime
        Public Property EndDate As DateTime
        Public Property Semester As Semesters
        Public Property StudentCount As Integer

        Public ReadOnly Property IsFull As Boolean
            Get
                Dim maximumStudents As Integer = _
                    Convert.ToInt32(ConfigurationManager.AppSettings("MaximumStudentsPerSubject"))
                Return StudentCount = maximumStudents
            End Get
        End Property

        Public ReadOnly Property ScheduleTime As String
            Get
                Return String.Format("{0} - {1}", StartTime.ToString("hh:mmtt"), EndTime.ToString("hh:mmtt"))
            End Get
        End Property

        Public ReadOnly Property SchoolYear As String
            Get
                Return String.Format("{0}-{1}", StartDate.Year, StartDate.AddYears(1).Year)
            End Get
        End Property

    End Class
End Namespace

